package fr.jade.fraclite.orb.api;

public interface Binder {

  /**
   * Creates a name in this naming context to designate the given object. The
   * {@link Name#getNamingContext getNamingContext} method of the returned name
   * will return this naming context, i.e.,
   * <tt>nc.export(o, hints).getNamingContext() == nc</tt>.
   *
   * @param o the object to be exported. This object may be a name of another
   *      naming context.
   * @param hints optional additional information.
   * @return a name that designates the given object in this naming context.
   * @throws NamingException if the given object cannot be exported.
   */

  Name export (Object o, Object hints) throws NamingException;
  
  /**
   * Returns an object that gives access to the object designated by the given
   * name. This name must belong to this naming context, i.e.,
   * <tt>nc.bind(n, hints)</tt> is valid only if <tt>n.getNamingContext() ==
   * nc</tt>. The object returned by this method implements the Java interface
   * of the designated object. It may also implement the {@link Name}
   * interface. This method creates a binding object (or a binding component
   * when it is used with the <a href="http://www.objectweb.org/fractal">Fractal
   * framework</a>) that gives access to the designated object (this binding
   * object can be empty, i.e., the bind method may directly return the
   * designated object itself).
   *
   * @param n a name that has been created by this naming context.
   * @param hints optional additional information.
   * @return an object that gives access to the object designated by <tt>n</tt>.
   *      This object may also implement the {@link Name} interface.
   * @throws NamingException if the binding fails (this is the case, for
   *      example, if the given name was not created by this naming context).
   */

  Object bind (Name n, Object hints) throws NamingException;
}
